package cn.ljy.mes.web.controller.backstage.count;

import cn.ljy.common.model.result.ResponseData;
import cn.ljy.mes.service.CountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "后台统计模块")
@RestController
@RequestMapping(value = "/backstage/visualize")
public class CountController {

	public static final Log log= LogFactory.getLog(CountController.class);

	@Resource
	private CountService countService;


	@ApiOperation(value = "热门生产车型排行榜", notes = "生产订单")
	@ApiImplicitParam(name = "limit", value = "展示数量",dataType="int", required = false,example="1")
	@GetMapping("/productModelsOrderByOrderCountDesc")
	public ResponseData getProductNameAndSalesVolumeData(Integer limit){
		return ResponseData.success(countService.getProductModelsOrderByOrderCountDesc(limit));
	}

	@ApiOperation(value = "生产各阶段的订单数", notes = "生产各阶段的订单数")
	@GetMapping("/productionOrderStatusCountWithPriorityOrder")
	public ResponseData getProductionOrderStatusCountWithPriorityOrder(){
		return ResponseData.success(countService.getProductionOrderStatusCountWithPriorityOrder());
	}

	@ApiOperation(value = "销售订单各阶段数量", notes = "生产各阶段的订单数")
	@GetMapping("/shopCarOrderStatusCountWithPriorityOrder")
	public ResponseData getShopCarOrderStatusCountWithPriorityOrder(){
		return ResponseData.success(countService.getShopCarOrderStatusCountWithPriorityOrder());
	}

	@ApiOperation(value = "整车首次车检通过情况", notes = "整车首次车检通过情况")
	@GetMapping("/firstApprovalPassedOrderCountAndOrderCount")
	public ResponseData getFirstApprovalPassedOrderCountAndOrderCount(){
		return ResponseData.success(countService.getFirstApprovalPassedOrderCountAndOrderCount());
	}
}
